{layout name="public/layout" /}
		{include file='yxnavbar'}
{if $op == 'add'}
<div class="clearfix">
	<form class="form-horizontal form" action="" method="post" encgiftgroup="multipart/form-data" >
		<div class="panel panel-default">
			<div class="panel-heading">添加评论</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-4 col-md-1 col-lg-1 control-label">评论内容</label>
					<div class="col-sm-8 col-xs-12">
						<textarea type="text" rows="10" class="form-control" placeholder="" name="comment" ></textarea>
						<span class="help-block">每一行为一条评论，头像和昵称系统会自动虚拟，前端默认显示最新的30条评论，先取真实用户审核通过的，再随机取手工添加</span>
					</div>
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-12">
				<input name="submit" type="submit" value="提交" class="btn btn-primary col-lg-1">
				<input type="hidden" name="__token__" value="{$Request.token}" />
			</div>
		</div>
	</form>
</div>
{elseif $op == 'display'}
<script type="text/javascript">
function submitForm(){
    var form = document.getElementById("myform");
    form.submit();
}
</script>
<div class="main">

		<div class="panel panel-info">
		<div class="panel-heading">当前搜索条件下 : <strong>{$total}</strong> 个</div>
		<div class="panel-body">
			<form id = "myform" action="./index.php" method="get" class="form-horizontal" role="form">
				<input type="hidden" name="c" value="site" />
				<input type="hidden" name="a" value="entry" />
				<input type="hidden" name="m" value="{$_P['m']}" />
				<input type="hidden" name="do" value="{$do}" />
				<div class="form-group">
					<label class="col-xs-1 col-sm-1 col-md-1 control-label">排序</label>
					<div class="col-xs-11 col-sm-9 col-md-9">
						<div class="btn-group">
							<a href="{php echo filter_url('type:-1');}" class="btn {if $type == -1}btn-primary{else}btn-default{/if}">所有</a>
							<a href="{php echo filter_url('type:0');}" class="btn {if $type == 0}btn-primary{else}btn-default{/if}">未审核<span style="color: #ff0000">{$comment_sum['t0']}</span></a>
							<a href="{php echo filter_url('type:1');}" class="btn {if $type == 1}btn-primary{else}btn-default{/if}">审核通过<span style="color: #ff0000">{$comment_sum['t1']}</span></a>
							<a href="{php echo filter_url('type:2');}" class="btn {if $type == 2}btn-primary{else}btn-default{/if}">审核未通过<span style="color: #ff0000">{$comment_sum['t2']}</span></a>
							<a href="{php echo filter_url('type:3');}" class="btn {if $type == 3}btn-primary{else}btn-default{/if}">系统自动屏蔽<span style="color: #ff0000">{$comment_sum['t3']}</span></a>
							<a href="{php echo filter_url('type:4');}" class="btn {if $type == 4}btn-primary{else}btn-default{/if}">手工添加<span style="color: #ff0000">{$comment_sum['t4']}</span></a>

						</div>
					</div>
					{if count($themelist)>1}
						<div class="col-xs-12 col-sm-2 col-md-2">
							 <select onchange="submitForm();" class="form-control" name="themeid">
	                   		{loop $themelist $row}
				         		<option value="{$row['id']}" {if $themeid == $row['id'] }selected="selected"{/if}>{$row['id']} - {php echo mb_substr($row['title'],0,8,'utf-8');}</option>
				       		{/loop}
				     		 </select>
			 			</div>
					{else}
						<input type="hidden" name="themeid" value="{$themeid}" /> 
					{/if}
				</div>
				<div class="form-group clearfix">
					<label class="col-xs-12 col-sm-3 col-md-1 control-label">发表时间</label>
					<div class="col-sm-4 col-lg-4 col-md-4 col-xs-6">
						{php echo view_form_field_daterange('createtime', array('start'=>date('Y-m-d H:i:s',$starttime),'end'=>date('Y-m-d H:i:s',$endtime)), true);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-1 control-label">关键字</label>
					<div class="col-sm-3 col-lg-3 col-md-3 col-xs-6">
						<input class="form-control" name="keyword" placeholder="输入昵称、姓名名、手机号或评论内容" type="text" value="{$_P['keyword']}">
					</div>
					<div class="col-sm-1 col-lg-1 col-md-1 col-xs-3">
						<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
						<input type="hidden" name="__token__" value="{$Request.token}"/>
					</div>
					<div class="col-sm-1 col-lg-1 col-md-1 col-xs-3">
						<a href="{php echo createWebUrl($do, array('op' => 'add','themeid'=>$themeid));}" class="btn btn-info"  data-toggle="tooltip" data-placement="top">添加评论</a>
					</div>
				</div>
			</form>
		</div>
			{if $type == 12}
			<div class="panel-footer">若用户出现在【不在活动地区】中，无法付款；不建议操作，误操作可能造成链接被微信封杀。100%确认客户无问题，可点击下方开启</div>
			{elseif $type == 7}
			<div class="panel-footer">若用户出现在【黑名单】中，无法访问链接；可确认客户无问题后，点击下方开启</div>
			{elseif $type == 9}
			<div class="panel-footer">【客资电话】通过小程序采集到电话会在此显示，若客户点了报名，付款或未付款都将移至【定单管理】中显示</div>
			{/if}
		</div>
	<form class="form-horizontal" action="" method="post" id="form-goods">
		<div class="panel panel-default">
			<div class="panel-body table-responsive">
				<table class="table table-hover">
					<thead class="navbar-inner">
						<tr>
							<th width="50">ID</th>
							<th>昵称</th>
							<th>姓名/电话</th>
							<th>评论内容</th>
							<th>快速审核</th>
							<th style="width:90px;">发表时间</th>
							<th style="width:90px;">审核记录</th>
							<th>员工</th>
							<th style="text-align:right;">操作</th>
						</tr>
					</thead>
					<tbody>
						{loop $list $row}
						<tr>
							<td>{$row['c_id']}</td>
							<td>
								{if stripos($row['nickname'],"<br>")==false}
								<a href="{php echo createWebUrl('scan', array('op' => 'display','themeid'=>$themeid,'keyword'=>$row['uid']));}">
									<img src="{php echo tomedia($row['avatar']);}" width="28" style="border-radius: 3px;"><br>
									{$row['nickname']}
								</a>
								{else}
								{$row['nickname']}
								{/if}
							</td>
							<td>{$row['username']}<br>{$row['mobile']}</td>
							<td>{php echo urldecode($row['msg']);}</td>
							<td>{php echo $statustr[$row['c_status']];}</td>
							<td  style="font-size: 10px;max-width: 100px;">{php echo str_replace(" ","<br>",$row['created_at']);}</td>
							<td  style="font-size: 10px;max-width: 100px;">{if !empty($row['admin_user'])}{$row['admin_user']}<br>{php echo str_replace(" ","<br>",$row['updated_at']);}{/if}</td>
							<td ><a href="{php echo createWebUrl('fans',array('themeid'=>$themeid,'workerid'=>$row['workerid'],'op'=>'display'));}" >{$row['workername']}<br>{$row['teamname']}<br>{php echo mb_substr($row['companyname'],0,6,'utf-8');}</a></td>
							<td style="text-align:right;">
								{if $row['c_status']==0 || $row['c_status']==2}
								<a href="{php echo createWebUrl($do, array('op' => 'status','type' => $type, 'status'=>1, 'c_id' => $row['c_id'],'themeid'=>$themeid));}" class="btn btn-success btn-sm" title="通过" data-toggle="tooltip" data-placement="top" ><i class="fa fa-arrow-left">通过</i></a>
								{/if}
								{if $row['c_status']==0 || $row['c_status']==1}
								<a href="{php echo createWebUrl($do, array('op' => 'status','type' => $type, 'status'=>2, 'c_id' => $row['c_id'],'themeid'=>$themeid));}" class="btn btn-info btn-sm" title="不通过" data-toggle="tooltip" data-placement="top" onclick="if(!confirm('确定不通过吗?')) return false;"><i class="fa fa-arrow-right">不通过</i></a>
								{/if}
								<a href="{php echo createWebUrl($do, array('op' => 'delete','type' => $type, 'c_id' => $row['c_id'],'themeid'=>$themeid));}" class="btn btn-warning btn-sm" title="删除" data-toggle="tooltip" data-placement="top" onclick="if(!confirm('删除后将不可恢复，确定删除吗?')) return false;"><i class="fa fa-times"> </i></a>
							</td>
						</tr>
						{/loop}
					</tbody>
				</table>
			</div>
		</div>
		{$pager}
	</form>
</div>

{/if}
